package com.work.vo.transport;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.work.constant.DictBizConstant;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.DictBizCache;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 航运配工VO
 *
 * @author ：dujianyu
 * @since ：Created in 2024/5/14 14:15
 */
@Data
public class WorkArrangeShipVO {

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "配工ID")
    private Long wasId;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "船ID")
    private Long shipId;

    @ApiModelProperty(value = "船名")
    private String shipName;

    @ApiModelProperty(value = "作业线号")
    private String lineNo;

    @ApiModelProperty(value = "日期")
    private LocalDate planDate;

    @ApiModelProperty(value = "时间段")
    private String shiftKey;

    @ApiModelProperty(value = "时间段")
    private String shiftKeyName;

    public String getShiftKeyName() {
        if (Func.isNull(shiftKey)) {
            return null;
        }
        return DictBizCache.getValue(DictBizConstant.TIME_SPACE, shiftKey);
    }

    @DateTimeFormat(pattern = "HH:mm")
    @JsonFormat(pattern = "HH:mm")
    @ApiModelProperty(value = "开始时间")
    private LocalDateTime startTime;

    @DateTimeFormat(pattern = "HH:mm")
    @JsonFormat(pattern = "HH:mm")
    @ApiModelProperty(value = "结束时间")
    private LocalDateTime endTime;

    @ApiModelProperty(value = "舱位")
    private String holds;

    @ApiModelProperty(value = "舱位名称")
    private String holdsName;

    @ApiModelProperty(value = "舱位列表")
    private List<HoldVO> holdsList;

}
